<template>
  <div class="m-recharge">
    <p class="m-title">{{title}}</p>
    <w-form-validate @on-validate="onValidateForm">
      <div class="m-form">
        <div class="item">
          <span class="title">真实姓名</span>
          <div class="a-input">
            <w-input holder="请填写"></w-input>
          </div>
        </div>
        <div class="item">
          <span class="title">证件类型</span>
          <div class="a-input">
            <w-select></w-select>
          </div>
        </div>
        <div class="item">
          <span class="title">证件号码</span>
          <div class="a-input">
            <w-input holder="请填写"></w-input>
          </div>
        </div>
        <div class="item">
          <span class="title">银行卡号</span>
          <div class="a-input">
            <w-input holder="请填写"></w-input>
          </div>
        </div>
        <div class="item" v-if="origin == 'pull'">
          <span class="title">账户总额</span>
          <div class="a-input">
            <w-input holder="请填写"></w-input>
          </div>
        </div>
        <div class="item" v-if="origin == 'pull'">
          <span class="title">可用提现额度</span>
          <div class="a-input">
            <w-input holder="请填写"></w-input>
          </div>
        </div>
        <div class="item" v-if="origin == 'pull'">
          <span class="title">提现额度</span>
          <div class="a-input">
            <w-input holder="请填写"></w-input>
          </div>
        </div>
        <div class="item" v-if="origin == 'pull'">
          <span class="title">交易密码</span>
          <div class="a-input">
            <w-input holder="请填写"></w-input>
          </div>
        </div>
        <div class="item" v-if="origin == 'push'">
          <span class="title">账户余额</span>
          <div class="a-input">
            <w-input holder="请填写"></w-input>
          </div>
        </div>
        <div class="item" v-if="origin == 'push'">
          <span class="title">充值金额</span>
          <div class="a-input">
            <w-input holder="请填写"></w-input>
          </div>
        </div>
        <div class="item">
          <span class="title">银行预留手机号码</span>
          <div class="a-input">
            <w-input holder="请填写"></w-input>
          </div>
        </div>
        <div class="item">
          <span class="title" style="vertical-align: top;margin-top: 6px;">手机验证码</span>
          <div class="clearfix a-input">
            <div class="fl a-input" style="width: 260px">
              <w-input holder="请填写"></w-input>
            </div>
            <div class="fr">
              <w-button-timer></w-button-timer>
            </div>
          </div>
        </div>
      </div>
      <div class="sub">
        <button class="btn main" type="submit">确认充值</button>
      </div>
    </w-form-validate>
  </div>
</template>

<script>
export default {
  data() {
    return {
      origin: this.$route.params.type || ''
    }
  },
  computed: {
    /**
     * 根据页面的目标来源，展示该页面标题
     */
    title() {
      if (!this.origin) return
      if (this.origin == 'push') {
        return '充值'
      }
      return '提现'
    }
  },
  methods: {
    /***
     * 提交验证
     */
    onValidateForm() {}
  }
}
</script>

<style lang="scss">
.m-form {
  .btn-ghost {
    width: 90px;
    height: 30px;
    &.code {
      border-radius: 0;
      background: rgba(255,255,255,1);
      border: 1px solid rgba(42,152,215,1);
      color: #2A98D7;
    }
  }
  .form-control {
    height: 30px;
  }
  .w-input .error-tip {
    left: 0;
  }
  .sub {
    .btn {
      width: 100%;
      height: 100%;
    }
  }
}
</style>

<style lang="scss" scoped>
.m-title {
  font-size: 16px;
  margin-bottom: 20px; 
  font-weight: bold;
}

.m-form {    
  text-align: right;
  width: 52%;
  margin: 20px auto;
  .item {
    padding-bottom: 20px;
    &:last-child {
      padding-bottom: 0;
    }
    .title {
      font-size: 12px;
      text-align: right;
      padding-right: 20px;
      display: inline-block;
    }
    .a-input {
      width: 360px;
      display: inline-block;
    }
    .m-code {
      display: inline-block;
    }
  }
}
.sub {
  width: 140px;
  height: 50px;
  margin: 30px auto 0;
}
</style>
